package org.imdm.portal.loadchecker.ui;

import java.util.Comparator;

import org.imdm.portal.loadchecker.ui.LoadInfo;

public class UserNumComparator implements Comparator {
	private boolean _asc;
	public UserNumComparator(boolean asc) {_asc = asc;}

	public int compare(Object o1, Object o2) {
		java.util.Map.Entry e1 = (java.util.Map.Entry)o1;
		java.util.Map.Entry e2 = (java.util.Map.Entry)o2;
		LoadInfo li1 = (LoadInfo)e1.getValue();
		LoadInfo li2 = (LoadInfo)e2.getValue();
		Integer un1 = new Integer(li1.getLogins());
		Integer un2 = new Integer(li2.getLogins());
		int v = un1.compareTo(un2);
		return _asc ? v : -v;
	}
}
